//
//  ShowFirstView.m
//  7.23第一次开启
//
//  Created by lovena on 15/7/23.
//  Copyright (c) 2015年 lovena. All rights reserved.
//

#import "ShowFirstView.h"

@implementation ShowFirstView

-(void)awakeFromNib
{
    //圆角设置
    self.cellView.layer.cornerRadius=4;
    self.cellView.layer.masksToBounds=YES;
    
    //关注
    self.label.layer.borderWidth=1;
    self.label.layer.borderColor=[UIColor redColor].CGColor;
    self.label.layer.cornerRadius=4;
    self.label.layer.masksToBounds=YES;
    
    
    //增加点击事件
    UITapGestureRecognizer *tap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(gotoNext)];
    [self addGestureRecognizer:tap];
    
    //偏好设置
//    NSUserDefaults *defaults=[NSUserDefaults standardUserDefaults];
//    _ishidden=[defaults boolForKey:@"ishidden"];
    _ishidden=NO;
    if (_ishidden) {
        self.alpha=0;
    }
    else
    {
        self.alpha=1.0;
    }
}
-(void)gotoNext
{
    //消失
    __block UIView *secView=self;
    [UIView animateWithDuration:1.0 animations:^{
    
        secView.alpha=0.0;
        [secView removeFromSuperview];
        secView=nil;
    }];
    _ishidden=YES;
    //偏好设置
    NSUserDefaults *defaults=[NSUserDefaults standardUserDefaults];
    [defaults setBool:_ishidden forKey:@"ishidden"];
}
@end
